home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue47 / Construc / TDM47_TLB.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-06-04  |  13.8 KB  |  317 lines

  1. unit TDM47_TLB;
  2.  
  3. // ************************************************************************ //
  4. // WARNING                                                                  //
  5. // -------                                                                  //
  6. // The types declared in this file were generated from data read from a     //
  7. // Type Library. If this type library is explicitly or indirectly (via      //
  8. // another type library referring to this type library) re-imported, or the //
  9. // 'Refresh' command of the Type Library Editor activated while editing the //
  10. // Type Library, the contents of this file will be regenerated and all      //
  11. // manual modifications will be lost.                                       //
  12. // ************************************************************************ //
  13.  
  14. // PASTLWTR : $Revision:   1.11.1.75  $
  15. // File generated on 1999/06/04 9:05:35 from Type Library described below.
  16.  
  17. // ************************************************************************ //
  18. // Type Lib: D:\USR\BOB\MAGAZINE\DELPHI.MAG\#47\src\TDM47.tlb
  19. // IID\LCID: {43CAE5E0-1A49-11D3-9349-0080C7C19BE0}\0
  20. // Helpfile: 
  21. // HelpString: TDM47 Library
  22. // Version:    1.0
  23. // ************************************************************************ //
  24.  
  25. interface
  26.  
  27. uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
  28.  
  29. // *********************************************************************//
  30. // GUIDS declared in the TypeLibrary. Following prefixes are used:      //
  31. //   Type Libraries     : LIBID_xxxx                                    //
  32. //   CoClasses          : CLASS_xxxx                                    //
  33. //   DISPInterfaces     : DIID_xxxx                                     //
  34. //   Non-DISP interfaces: IID_xxxx                                      //
  35. // *********************************************************************//
  36. const
  37.   LIBID_TDM47: TGUID = '{43CAE5E0-1A49-11D3-9349-0080C7C19BE0}';
  38.   IID_ITDM47X: TGUID = '{43CAE5E1-1A49-11D3-9349-0080C7C19BE0}';
  39.   DIID_ITDM47XEvents: TGUID = '{43CAE5E3-1A49-11D3-9349-0080C7C19BE0}';
  40.   CLASS_TDM47X: TGUID = '{43CAE5E5-1A49-11D3-9349-0080C7C19BE0}';
  41.  
  42. // *********************************************************************//
  43. // Declaration of Enumerations defined in Type Library                  //
  44. // *********************************************************************//
  45. // TxActiveFormBorderStyle constants
  46. type
  47.   TxActiveFormBorderStyle = TOleEnum;
  48. const
  49.   afbNone = $00000000;
  50.   afbSingle = $00000001;
  51.   afbSunken = $00000002;
  52.   afbRaised = $00000003;
  53.  
  54. // TxPrintScale constants
  55. type
  56.   TxPrintScale = TOleEnum;
  57. const
  58.   poNone = $00000000;
  59.   poProportional = $00000001;
  60.   poPrintToFit = $00000002;
  61.  
  62. // TxMouseButton constants
  63. type
  64.   TxMouseButton = TOleEnum;
  65. const
  66.   mbLeft = $00000000;
  67.   mbRight = $00000001;
  68.   mbMiddle = $00000002;
  69.  
  70. // TxBiDiMode constants
  71. type
  72.   TxBiDiMode = TOleEnum;
  73. const
  74.   bdLeftToRight = $00000000;
  75.   bdRightToLeft = $00000001;
  76.   bdRightToLeftNoAlign = $00000002;
  77.   bdRightToLeftReadingOnly = $00000003;
  78.  
  79. type
  80.  
  81. // *********************************************************************//
  82. // Forward declaration of interfaces defined in Type Library            //
  83. // *********************************************************************//
  84.   ITDM47X = interface;
  85.   ITDM47XDisp = dispinterface;
  86.   ITDM47XEvents = dispinterface;
  87.  
  88. // *********************************************************************//
  89. // Declaration of CoClasses defined in Type Library                     //
  90. // (NOTE: Here we map each CoClass to its Default Interface)            //
  91. // *********************************************************************//
  92.   TDM47X = ITDM47X;
  93.  
  94.  
  95. // *********************************************************************//
  96. // Declaration of structures, unions and aliases.                       //
  97. // *********************************************************************//
  98.   PPUserType1 = ^IFontDisp; {*}
  99.  
  100.  
  101. // *********************************************************************//
  102. // Interface: ITDM47X
  103. // Flags:     (4416) Dual OleAutomation Dispatchable
  104. // GUID:      {43CAE5E1-1A49-11D3-9349-0080C7C19BE0}
  105. // *********************************************************************//
  106.   ITDM47X = interface(IDispatch)
  107.     ['{43CAE5E1-1A49-11D3-9349-0080C7C19BE0}']
  108.     function Get_Visible: WordBool; safecall;
  109.     procedure Set_Visible(Value: WordBool); safecall;
  110.     function Get_AutoScroll: WordBool; safecall;
  111.     procedure Set_AutoScroll(Value: WordBool); safecall;
  112.     function Get_AutoSize: WordBool; safecall;
  113.     procedure Set_AutoSize(Value: WordBool); safecall;
  114.     function Get_AxBorderStyle: TxActiveFormBorderStyle; safecall;
  115.     procedure Set_AxBorderStyle(Value: TxActiveFormBorderStyle); safecall;
  116.     function Get_Caption: WideString; safecall;
  117.     procedure Set_Caption(const Value: WideString); safecall;
  118.     function Get_Color: OLE_COLOR; safecall;
  119.     procedure Set_Color(Value: OLE_COLOR); safecall;
  120.     function Get_Font: IFontDisp; safecall;
  121.     procedure _Set_Font(const Value: IFontDisp); safecall;
  122.     procedure Set_Font(var Value: IFontDisp); safecall;
  123.     function Get_KeyPreview: WordBool; safecall;
  124.     procedure Set_KeyPreview(Value: WordBool); safecall;
  125.     function Get_PixelsPerInch: Integer; safecall;
  126.     procedure Set_PixelsPerInch(Value: Integer); safecall;
  127.     function Get_PrintScale: TxPrintScale; safecall;
  128.     procedure Set_PrintScale(Value: TxPrintScale); safecall;
  129.     function Get_Scaled: WordBool; safecall;
  130.     procedure Set_Scaled(Value: WordBool); safecall;
  131.     function Get_Active: WordBool; safecall;
  132.     function Get_DropTarget: WordBool; safecall;
  133.     procedure Set_DropTarget(Value: WordBool); safecall;
  134.     function Get_HelpFile: WideString; safecall;
  135.     procedure Set_HelpFile(const Value: WideString); safecall;
  136.     function Get_DoubleBuffered: WordBool; safecall;
  137.     procedure Set_DoubleBuffered(Value: WordBool); safecall;
  138.     function Get_Enabled: WordBool; safecall;
  139.     procedure Set_Enabled(Value: WordBool); safecall;
  140.     function Get_BiDiMode: TxBiDiMode; safecall;
  141.     procedure Set_BiDiMode(Value: TxBiDiMode); safecall;
  142.     function Get_Cursor: Smallint; safecall;
  143.     procedure Set_Cursor(Value: Smallint); safecall;
  144.     property Visible: WordBool read Get_Visible write Set_Visible;
  145.     property AutoScroll: WordBool read Get_AutoScroll write Set_AutoScroll;
  146.     property AutoSize: WordBool read Get_AutoSize write Set_AutoSize;
  147.     property AxBorderStyle: TxActiveFormBorderStyle read Get_AxBorderStyle write Set_AxBorderStyle;
  148.     property Caption: WideString read Get_Caption write Set_Caption;
  149.     property Color: OLE_COLOR read Get_Color write Set_Color;
  150.     property Font: IFontDisp read Get_Font write _Set_Font;
  151.     property KeyPreview: WordBool read Get_KeyPreview write Set_KeyPreview;
  152.     property PixelsPerInch: Integer read Get_PixelsPerInch write Set_PixelsPerInch;
  153.     property PrintScale: TxPrintScale read Get_PrintScale write Set_PrintScale;
  154.     property Scaled: WordBool read Get_Scaled write Set_Scaled;
  155.     property Active: WordBool read Get_Active;
  156.     property DropTarget: WordBool read Get_DropTarget write Set_DropTarget;
  157.     property HelpFile: WideString read Get_HelpFile write Set_HelpFile;
  158.     property DoubleBuffered: WordBool read Get_DoubleBuffered write Set_DoubleBuffered;
  159.     property Enabled: WordBool read Get_Enabled write Set_Enabled;
  160.     property BiDiMode: TxBiDiMode read Get_BiDiMode write Set_BiDiMode;
  161.     property Cursor: Smallint read Get_Cursor write Set_Cursor;
  162.   end;
  163.  
  164. // *********************************************************************//
  165. // DispIntf:  ITDM47XDisp
  166. // Flags:     (4416) Dual OleAutomation Dispatchable
  167. // GUID:      {43CAE5E1-1A49-11D3-9349-0080C7C19BE0}
  168. // *********************************************************************//
  169.   ITDM47XDisp = dispinterface
  170.     ['{43CAE5E1-1A49-11D3-9349-0080C7C19BE0}']
  171.     property Visible: WordBool dispid 1;
  172.     property AutoScroll: WordBool dispid 2;
  173.     property AutoSize: WordBool dispid 3;
  174.     property AxBorderStyle: TxActiveFormBorderStyle dispid 4;
  175.     property Caption: WideString dispid -518;
  176.     property Color: OLE_COLOR dispid -501;
  177.     property Font: IFontDisp dispid -512;
  178.     property KeyPreview: WordBool dispid 5;
  179.     property PixelsPerInch: Integer dispid 6;
  180.     property PrintScale: TxPrintScale dispid 7;
  181.     property Scaled: WordBool dispid 8;
  182.     property Active: WordBool readonly dispid 9;
  183.     property DropTarget: WordBool dispid 10;
  184.     property HelpFile: WideString dispid 11;
  185.     property DoubleBuffered: WordBool dispid 12;
  186.     property Enabled: WordBool dispid -514;
  187.     property BiDiMode: TxBiDiMode dispid 13;
  188.     property Cursor: Smallint dispid 14;
  189.   end;
  190.  
  191. // *********************************************************************//
  192. // DispIntf:  ITDM47XEvents
  193. // Flags:     (0)
  194. // GUID:      {43CAE5E3-1A49-11D3-9349-0080C7C19BE0}
  195. // *********************************************************************//
  196.   ITDM47XEvents = dispinterface
  197.     ['{43CAE5E3-1A49-11D3-9349-0080C7C19BE0}']
  198.     procedure OnActivate; dispid 1;
  199.     procedure OnClick; dispid 2;
  200.     procedure OnCreate; dispid 3;
  201.     procedure OnDblClick; dispid 4;
  202.     procedure OnDestroy; dispid 5;
  203.     procedure OnDeactivate; dispid 6;
  204.     procedure OnKeyPress(var Key: Smallint); dispid 10;
  205.     procedure OnPaint; dispid 15;
  206.   end;
  207.  
  208.  
  209. // *********************************************************************//
  210. // OLE Control Proxy class declaration
  211. // Control Name     : TTDM47X
  212. // Help String      : TDM47X Control
  213. // Default Interface: ITDM47X
  214. // Def. Intf. DISP? : No
  215. // Event   Interface: ITDM47XEvents
  216. // TypeFlags        : (34) CanCreate Control
  217. // *********************************************************************//
  218.   TTDM47XOnKeyPress = procedure(Sender: TObject; var Key: Smallint) of object;
  219.  
  220.   TTDM47X = class(TOleControl)
  221.   private
  222.     FOnActivate: TNotifyEvent;
  223.     FITDM47XEvents_OnClick: TNotifyEvent;
  224.     FOnCreate: TNotifyEvent;
  225.     FITDM47XEvents_OnDblClick: TNotifyEvent;
  226.     FOnDestroy: TNotifyEvent;
  227.     FOnDeactivate: TNotifyEvent;
  228.     FITDM47XEvents_OnKeyPress: TTDM47XOnKeyPress;
  229.     FOnPaint: TNotifyEvent;
  230.     FIntf: ITDM47X;
  231.     function  GetControlInterface: ITDM47X;
  232.   protected
  233.     procedure CreateControl;
  234.     procedure InitControlData; override;
  235.   public
  236.     property  ControlInterface: ITDM47X read GetControlInterface;
  237.     property Visible: WordBool index 1 read GetWordBoolProp write SetWordBoolProp;
  238.     property Active: WordBool index 9 read GetWordBoolProp;
  239.     property DropTarget: WordBool index 10 read GetWordBoolProp write SetWordBoolProp;
  240.     property HelpFile: WideString index 11 read GetWideStringProp write SetWideStringProp;
  241.     property DoubleBuffered: WordBool index 12 read GetWordBoolProp write SetWordBoolProp;
  242.     property Enabled: WordBool index -514 read GetWordBoolProp write SetWordBoolProp;
  243.     property BiDiMode: TOleEnum index 13 read GetTOleEnumProp write SetTOleEnumProp;
  244.   published
  245.     property AutoScroll: WordBool index 2 read GetWordBoolProp write SetWordBoolProp stored False;
  246.     property AutoSize: WordBool index 3 read GetWordBoolProp write SetWordBoolProp stored False;
  247.     property AxBorderStyle: TOleEnum index 4 read GetTOleEnumProp write SetTOleEnumProp stored False;
  248.     property Caption: WideString index -518 read GetWideStringProp write SetWideStringProp stored False;
  249.     property Color: TColor index -501 read GetTColorProp write SetTColorProp stored False;
  250.     property Font: TFont index -512 read GetTFontProp write SetTFontProp stored False;
  251.     property KeyPreview: WordBool index 5 read GetWordBoolProp write SetWordBoolProp stored False;
  252.     property PixelsPerInch: Integer index 6 read GetIntegerProp write SetIntegerProp stored False;
  253.     property PrintScale: TOleEnum index 7 read GetTOleEnumProp write SetTOleEnumProp stored False;
  254.     property Scaled: WordBool index 8 read GetWordBoolProp write SetWordBoolProp stored False;
  255.     property Cursor: Smallint index 14 read GetSmallintProp write SetSmallintProp stored False;
  256.     property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
  257.     property ITDM47XEvents_OnClick: TNotifyEvent read FITDM47XEvents_OnClick write FITDM47XEvents_OnClick;
  258.     property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
  259.     property ITDM47XEvents_OnDblClick: TNotifyEvent read FITDM47XEvents_OnDblClick write FITDM47XEvents_OnDblClick;
  260.     property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
  261.     property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
  262.     property ITDM47XEvents_OnKeyPress: TTDM47XOnKeyPress read FITDM47XEvents_OnKeyPress write FITDM47XEvents_OnKeyPress;
  263.     property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
  264.   end;
  265.  
  266. procedure Register;
  267.  
  268. implementation
  269.  
  270. uses ComObj;
  271.  
  272. procedure TTDM47X.InitControlData;
  273. const
  274.   CEventDispIDs: array [0..7] of DWORD = (
  275.     $00000001, $00000002, $00000003, $00000004, $00000005, $00000006,
  276.     $0000000A, $0000000F);
  277.   CTFontIDs: array [0..0] of DWORD = (
  278.     $FFFFFE00);
  279.   CControlData: TControlData2 = (
  280.     ClassID: '{43CAE5E5-1A49-11D3-9349-0080C7C19BE0}';
  281.     EventIID: '{43CAE5E3-1A49-11D3-9349-0080C7C19BE0}';
  282.     EventCount: 8;
  283.     EventDispIDs: @CEventDispIDs;
  284.     LicenseKey: nil;
  285.     Flags: $0000001D;
  286.     Version: 401;
  287.     FontCount: 1;
  288.     FontIDs: @CTFontIDs);
  289. begin
  290.   ControlData := @CControlData;
  291.   TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnActivate) - Cardinal(Self);
  292. end;
  293.  
  294. procedure TTDM47X.CreateControl;
  295.  
  296.   procedure DoCreate;
  297.   begin
  298.     FIntf := IUnknown(OleObject) as ITDM47X;
  299.   end;
  300.  
  301. begin
  302.   if FIntf = nil then DoCreate;
  303. end;
  304.  
  305. function TTDM47X.GetControlInterface: ITDM47X;
  306. begin
  307.   CreateControl;
  308.   Result := FIntf;
  309. end;
  310.  
  311. procedure Register;
  312. begin
  313.   RegisterComponents('ActiveX',[TTDM47X]);
  314. end;
  315.  
  316. end.
  317.